3.3.51 \(\int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx\) [251]

3.3.51.1 Optimal result
3.3.51.2 Mathematica [A] (verified)
3.3.51.3 Rubi [A] (verified)
3.3.51.4 Maple [A] (verified)
3.3.51.5 Fricas [B] (verification not implemented)
3.3.51.6 Sympy [F]
3.3.51.7 Maxima [F(-2)]
3.3.51.8 Giac [B] (verification not implemented)
3.3.51.9 Mupad [B] (verification not implemented)

3.3.51.1 Optimal result

Integrand size = 29, antiderivative size = 237 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\frac {\left (2 a c^3-4 b c^2 d+3 a c d^2-b d^3\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{(c-d)^{7/2} (c+d)^{7/2} f}+\frac {(b c-a d) \tan (e+f x)}{3 \left (c^2-d^2\right ) f (c+d \sec (e+f x))^3}+\frac {\left (2 b c^2-5 a c d+3 b d^2\right ) \tan (e+f x)}{6 \left (c^2-d^2\right )^2 f (c+d \sec (e+f x))^2}+\frac {\left (2 b c^3-11 a c^2 d+13 b c d^2-4 a d^3\right ) \tan (e+f x)}{6 \left (c^2-d^2\right )^3 f (c+d \sec (e+f x))} \]

output
(2*a*c^3+3*a*c*d^2-4*b*c^2*d-b*d^3)*arctanh((c-d)^(1/2)*tan(1/2*f*x+1/2*e) 
/(c+d)^(1/2))/(c-d)^(7/2)/(c+d)^(7/2)/f+1/3*(-a*d+b*c)*tan(f*x+e)/(c^2-d^2 
)/f/(c+d*sec(f*x+e))^3+1/6*(-5*a*c*d+2*b*c^2+3*b*d^2)*tan(f*x+e)/(c^2-d^2) 
^2/f/(c+d*sec(f*x+e))^2+1/6*(-11*a*c^2*d-4*a*d^3+2*b*c^3+13*b*c*d^2)*tan(f 
*x+e)/(c^2-d^2)^3/f/(c+d*sec(f*x+e))
 
3.3.51.2 Mathematica [A] (verified)

Time = 2.01 (sec) , antiderivative size = 405, normalized size of antiderivative = 1.71 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\frac {(d+c \cos (e+f x)) \sec ^3(e+f x) (a+b \sec (e+f x)) \left (\frac {24 \left (-b d \left (4 c^2+d^2\right )+a \left (2 c^3+3 c d^2\right )\right ) \text {arctanh}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right ) (d+c \cos (e+f x))^3}{\sqrt {c^2-d^2}}-6 b c^5 \sin (e+f x)+18 a c^4 d \sin (e+f x)-18 b c^3 d^2 \sin (e+f x)+39 a c^2 d^3 \sin (e+f x)-51 b c d^4 \sin (e+f x)+18 a d^5 \sin (e+f x)-12 b c^4 d \sin (2 (e+f x))+54 a c^3 d^2 \sin (2 (e+f x))-54 b c^2 d^3 \sin (2 (e+f x))+6 a c d^4 \sin (2 (e+f x))+6 b d^5 \sin (2 (e+f x))-6 b c^5 \sin (3 (e+f x))+18 a c^4 d \sin (3 (e+f x))-10 b c^3 d^2 \sin (3 (e+f x))-5 a c^2 d^3 \sin (3 (e+f x))+b c d^4 \sin (3 (e+f x))+2 a d^5 \sin (3 (e+f x))\right )}{24 \left (-c^2+d^2\right )^3 f (b+a \cos (e+f x)) (c+d \sec (e+f x))^4} \]

input
Integrate[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x])^4,x]
 
output
((d + c*Cos[e + f*x])*Sec[e + f*x]^3*(a + b*Sec[e + f*x])*((24*(-(b*d*(4*c 
^2 + d^2)) + a*(2*c^3 + 3*c*d^2))*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt 
[c^2 - d^2]]*(d + c*Cos[e + f*x])^3)/Sqrt[c^2 - d^2] - 6*b*c^5*Sin[e + f*x 
] + 18*a*c^4*d*Sin[e + f*x] - 18*b*c^3*d^2*Sin[e + f*x] + 39*a*c^2*d^3*Sin 
[e + f*x] - 51*b*c*d^4*Sin[e + f*x] + 18*a*d^5*Sin[e + f*x] - 12*b*c^4*d*S 
in[2*(e + f*x)] + 54*a*c^3*d^2*Sin[2*(e + f*x)] - 54*b*c^2*d^3*Sin[2*(e + 
f*x)] + 6*a*c*d^4*Sin[2*(e + f*x)] + 6*b*d^5*Sin[2*(e + f*x)] - 6*b*c^5*Si 
n[3*(e + f*x)] + 18*a*c^4*d*Sin[3*(e + f*x)] - 10*b*c^3*d^2*Sin[3*(e + f*x 
)] - 5*a*c^2*d^3*Sin[3*(e + f*x)] + b*c*d^4*Sin[3*(e + f*x)] + 2*a*d^5*Sin 
[3*(e + f*x)]))/(24*(-c^2 + d^2)^3*f*(b + a*Cos[e + f*x])*(c + d*Sec[e + f 
*x])^4)
 
3.3.51.3 Rubi [A] (verified)

Time = 1.19 (sec) , antiderivative size = 278, normalized size of antiderivative = 1.17, number of steps used = 15, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.483, Rules used = {3042, 4491, 25, 3042, 4491, 25, 3042, 4491, 27, 3042, 4318, 3042, 3138, 221}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right ) \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right )}{\left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^4}dx\)

\(\Big \downarrow \) 4491

\(\displaystyle \frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}-\frac {\int -\frac {\sec (e+f x) (3 (a c-b d)+2 (b c-a d) \sec (e+f x))}{(c+d \sec (e+f x))^3}dx}{3 \left (c^2-d^2\right )}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {\sec (e+f x) (3 (a c-b d)+2 (b c-a d) \sec (e+f x))}{(c+d \sec (e+f x))^3}dx}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {\csc \left (e+f x+\frac {\pi }{2}\right ) \left (3 (a c-b d)+2 (b c-a d) \csc \left (e+f x+\frac {\pi }{2}\right )\right )}{\left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^3}dx}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 4491

\(\displaystyle \frac {\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}-\frac {\int -\frac {\sec (e+f x) \left (2 \left (3 a c^2-5 b d c+2 a d^2\right )+\left (2 b c^2-5 a d c+3 b d^2\right ) \sec (e+f x)\right )}{(c+d \sec (e+f x))^2}dx}{2 \left (c^2-d^2\right )}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\frac {\int \frac {\sec (e+f x) \left (2 \left (3 a c^2-5 b d c+2 a d^2\right )+\left (2 b c^2-5 a d c+3 b d^2\right ) \sec (e+f x)\right )}{(c+d \sec (e+f x))^2}dx}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\int \frac {\csc \left (e+f x+\frac {\pi }{2}\right ) \left (2 \left (3 a c^2-5 b d c+2 a d^2\right )+\left (2 b c^2-5 a d c+3 b d^2\right ) \csc \left (e+f x+\frac {\pi }{2}\right )\right )}{\left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2}dx}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 4491

\(\displaystyle \frac {\frac {\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}-\frac {\int -\frac {3 \left (2 a c^3-4 b d c^2+3 a d^2 c-b d^3\right ) \sec (e+f x)}{c+d \sec (e+f x)}dx}{c^2-d^2}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\frac {\frac {3 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \int \frac {\sec (e+f x)}{c+d \sec (e+f x)}dx}{c^2-d^2}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {3 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx}{c^2-d^2}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 4318

\(\displaystyle \frac {\frac {\frac {3 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \int \frac {1}{\frac {c \cos (e+f x)}{d}+1}dx}{d \left (c^2-d^2\right )}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {3 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \int \frac {1}{\frac {c \sin \left (e+f x+\frac {\pi }{2}\right )}{d}+1}dx}{d \left (c^2-d^2\right )}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {\frac {\frac {6 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \int \frac {1}{\left (1-\frac {c}{d}\right ) \tan ^2\left (\frac {1}{2} (e+f x)\right )+\frac {c+d}{d}}d\tan \left (\frac {1}{2} (e+f x)\right )}{d f \left (c^2-d^2\right )}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {\frac {6 \left (2 a c^3+3 a c d^2-4 b c^2 d-b d^3\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{f \sqrt {c-d} \sqrt {c+d} \left (c^2-d^2\right )}+\frac {\left (-11 a c^2 d-4 a d^3+2 b c^3+13 b c d^2\right ) \tan (e+f x)}{f \left (c^2-d^2\right ) (c+d \sec (e+f x))}}{2 \left (c^2-d^2\right )}+\frac {\left (-5 a c d+2 b c^2+3 b d^2\right ) \tan (e+f x)}{2 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^2}}{3 \left (c^2-d^2\right )}+\frac {(b c-a d) \tan (e+f x)}{3 f \left (c^2-d^2\right ) (c+d \sec (e+f x))^3}\)

input
Int[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x])^4,x]
 
output
((b*c - a*d)*Tan[e + f*x])/(3*(c^2 - d^2)*f*(c + d*Sec[e + f*x])^3) + (((2 
*b*c^2 - 5*a*c*d + 3*b*d^2)*Tan[e + f*x])/(2*(c^2 - d^2)*f*(c + d*Sec[e + 
f*x])^2) + ((6*(2*a*c^3 - 4*b*c^2*d + 3*a*c*d^2 - b*d^3)*ArcTanh[(Sqrt[c - 
 d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(Sqrt[c - d]*Sqrt[c + d]*(c^2 - d^2)*f 
) + ((2*b*c^3 - 11*a*c^2*d + 13*b*c*d^2 - 4*a*d^3)*Tan[e + f*x])/((c^2 - d 
^2)*f*(c + d*Sec[e + f*x])))/(2*(c^2 - d^2)))/(3*(c^2 - d^2))
 

3.3.51.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 4318
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[1/b   Int[1/(1 + (a/b)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, 
f}, x] && NeQ[a^2 - b^2, 0]
 

rule 4491
Int[csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(cs 
c[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b - a*B))*Cot[e 
 + f*x]*((a + b*Csc[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 - b^2))), x] + Simp[1 
/((m + 1)*(a^2 - b^2))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*Simp 
[(a*A - b*B)*(m + 1) - (A*b - a*B)*(m + 2)*Csc[e + f*x], x], x], x] /; Free 
Q[{a, b, A, B, e, f}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LtQ[m 
, -1]
 
3.3.51.4 Maple [A] (verified)

Time = 1.28 (sec) , antiderivative size = 376, normalized size of antiderivative = 1.59

method result size
derivativedivides \(\frac {-\frac {2 \left (-\frac {\left (6 a \,c^{2} d +3 a c \,d^{2}+2 a \,d^{3}-2 b \,c^{3}-2 b \,c^{2} d -6 b c \,d^{2}-b \,d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{2 \left (c -d \right ) \left (c^{3}+3 c^{2} d +3 c \,d^{2}+d^{3}\right )}+\frac {2 \left (9 a \,c^{2} d +a \,d^{3}-3 b \,c^{3}-7 b c \,d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3 \left (c^{2}+2 c d +d^{2}\right ) \left (c^{2}-2 c d +d^{2}\right )}-\frac {\left (6 a \,c^{2} d -3 a c \,d^{2}+2 a \,d^{3}-2 b \,c^{3}+2 b \,c^{2} d -6 b c \,d^{2}+b \,d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{2 \left (c +d \right ) \left (c^{3}-3 c^{2} d +3 c \,d^{2}-d^{3}\right )}\right )}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )^{3}}+\frac {\left (2 a \,c^{3}+3 a c \,d^{2}-4 b \,c^{2} d -b \,d^{3}\right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c^{6}-3 c^{4} d^{2}+3 c^{2} d^{4}-d^{6}\right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f}\) \(376\)
default \(\frac {-\frac {2 \left (-\frac {\left (6 a \,c^{2} d +3 a c \,d^{2}+2 a \,d^{3}-2 b \,c^{3}-2 b \,c^{2} d -6 b c \,d^{2}-b \,d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{2 \left (c -d \right ) \left (c^{3}+3 c^{2} d +3 c \,d^{2}+d^{3}\right )}+\frac {2 \left (9 a \,c^{2} d +a \,d^{3}-3 b \,c^{3}-7 b c \,d^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3 \left (c^{2}+2 c d +d^{2}\right ) \left (c^{2}-2 c d +d^{2}\right )}-\frac {\left (6 a \,c^{2} d -3 a c \,d^{2}+2 a \,d^{3}-2 b \,c^{3}+2 b \,c^{2} d -6 b c \,d^{2}+b \,d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{2 \left (c +d \right ) \left (c^{3}-3 c^{2} d +3 c \,d^{2}-d^{3}\right )}\right )}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )^{3}}+\frac {\left (2 a \,c^{3}+3 a c \,d^{2}-4 b \,c^{2} d -b \,d^{3}\right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c^{6}-3 c^{4} d^{2}+3 c^{2} d^{4}-d^{6}\right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{f}\) \(376\)
risch \(\text {Expression too large to display}\) \(1386\)

input
int(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e))^4,x,method=_RETURNVERBOSE 
)
 
output
1/f*(-2*(-1/2*(6*a*c^2*d+3*a*c*d^2+2*a*d^3-2*b*c^3-2*b*c^2*d-6*b*c*d^2-b*d 
^3)/(c-d)/(c^3+3*c^2*d+3*c*d^2+d^3)*tan(1/2*f*x+1/2*e)^5+2/3*(9*a*c^2*d+a* 
d^3-3*b*c^3-7*b*c*d^2)/(c^2+2*c*d+d^2)/(c^2-2*c*d+d^2)*tan(1/2*f*x+1/2*e)^ 
3-1/2*(6*a*c^2*d-3*a*c*d^2+2*a*d^3-2*b*c^3+2*b*c^2*d-6*b*c*d^2+b*d^3)/(c+d 
)/(c^3-3*c^2*d+3*c*d^2-d^3)*tan(1/2*f*x+1/2*e))/(tan(1/2*f*x+1/2*e)^2*c-ta 
n(1/2*f*x+1/2*e)^2*d-c-d)^3+(2*a*c^3+3*a*c*d^2-4*b*c^2*d-b*d^3)/(c^6-3*c^4 
*d^2+3*c^2*d^4-d^6)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/( 
(c+d)*(c-d))^(1/2)))
 
3.3.51.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 590 vs. \(2 (222) = 444\).

Time = 0.36 (sec) , antiderivative size = 1238, normalized size of antiderivative = 5.22 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\text {Too large to display} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e))^4,x, algorithm="fri 
cas")
 
output
[1/12*(3*(2*a*c^3*d^3 - 4*b*c^2*d^4 + 3*a*c*d^5 - b*d^6 + (2*a*c^6 - 4*b*c 
^5*d + 3*a*c^4*d^2 - b*c^3*d^3)*cos(f*x + e)^3 + 3*(2*a*c^5*d - 4*b*c^4*d^ 
2 + 3*a*c^3*d^3 - b*c^2*d^4)*cos(f*x + e)^2 + 3*(2*a*c^4*d^2 - 4*b*c^3*d^3 
 + 3*a*c^2*d^4 - b*c*d^5)*cos(f*x + e))*sqrt(c^2 - d^2)*log((2*c*d*cos(f*x 
 + e) - (c^2 - 2*d^2)*cos(f*x + e)^2 + 2*sqrt(c^2 - d^2)*(d*cos(f*x + e) + 
 c)*sin(f*x + e) + 2*c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x + e) + 
 d^2)) + 2*(2*b*c^5*d^2 - 11*a*c^4*d^3 + 11*b*c^3*d^4 + 7*a*c^2*d^5 - 13*b 
*c*d^6 + 4*a*d^7 + (6*b*c^7 - 18*a*c^6*d + 4*b*c^5*d^2 + 23*a*c^4*d^3 - 11 
*b*c^3*d^4 - 7*a*c^2*d^5 + b*c*d^6 + 2*a*d^7)*cos(f*x + e)^2 + 3*(2*b*c^6* 
d - 9*a*c^5*d^2 + 7*b*c^4*d^3 + 8*a*c^3*d^4 - 10*b*c^2*d^5 + a*c*d^6 + b*d 
^7)*cos(f*x + e))*sin(f*x + e))/((c^11 - 4*c^9*d^2 + 6*c^7*d^4 - 4*c^5*d^6 
 + c^3*d^8)*f*cos(f*x + e)^3 + 3*(c^10*d - 4*c^8*d^3 + 6*c^6*d^5 - 4*c^4*d 
^7 + c^2*d^9)*f*cos(f*x + e)^2 + 3*(c^9*d^2 - 4*c^7*d^4 + 6*c^5*d^6 - 4*c^ 
3*d^8 + c*d^10)*f*cos(f*x + e) + (c^8*d^3 - 4*c^6*d^5 + 6*c^4*d^7 - 4*c^2* 
d^9 + d^11)*f), 1/6*(3*(2*a*c^3*d^3 - 4*b*c^2*d^4 + 3*a*c*d^5 - b*d^6 + (2 
*a*c^6 - 4*b*c^5*d + 3*a*c^4*d^2 - b*c^3*d^3)*cos(f*x + e)^3 + 3*(2*a*c^5* 
d - 4*b*c^4*d^2 + 3*a*c^3*d^3 - b*c^2*d^4)*cos(f*x + e)^2 + 3*(2*a*c^4*d^2 
 - 4*b*c^3*d^3 + 3*a*c^2*d^4 - b*c*d^5)*cos(f*x + e))*sqrt(-c^2 + d^2)*arc 
tan(-sqrt(-c^2 + d^2)*(d*cos(f*x + e) + c)/((c^2 - d^2)*sin(f*x + e))) + ( 
2*b*c^5*d^2 - 11*a*c^4*d^3 + 11*b*c^3*d^4 + 7*a*c^2*d^5 - 13*b*c*d^6 + ...
 
3.3.51.6 Sympy [F]

\[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\int \frac {\left (a + b \sec {\left (e + f x \right )}\right ) \sec {\left (e + f x \right )}}{\left (c + d \sec {\left (e + f x \right )}\right )^{4}}\, dx \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e))**4,x)
 
output
Integral((a + b*sec(e + f*x))*sec(e + f*x)/(c + d*sec(e + f*x))**4, x)
 
3.3.51.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\text {Exception raised: ValueError} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e))^4,x, algorithm="max 
ima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?` f 
or more de
 
3.3.51.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 693 vs. \(2 (222) = 444\).

Time = 0.40 (sec) , antiderivative size = 693, normalized size of antiderivative = 2.92 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=-\frac {\frac {3 \, {\left (2 \, a c^{3} - 4 \, b c^{2} d + 3 \, a c d^{2} - b d^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, c - 2 \, d\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )}}{{\left (c^{6} - 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} - d^{6}\right )} \sqrt {-c^{2} + d^{2}}} + \frac {6 \, b c^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 18 \, a c^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 6 \, b c^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 27 \, a c^{3} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 12 \, b c^{3} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 6 \, a c^{2} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 27 \, b c^{2} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 3 \, a c d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 12 \, b c d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 6 \, a d^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 3 \, b d^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} - 12 \, b c^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 36 \, a c^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 16 \, b c^{3} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 32 \, a c^{2} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 28 \, b c d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 4 \, a d^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 6 \, b c^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 18 \, a c^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 \, b c^{4} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 27 \, a c^{3} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 \, b c^{3} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 6 \, a c^{2} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 27 \, b c^{2} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 \, a c d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 12 \, b c d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 6 \, a d^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 \, b d^{5} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (c^{6} - 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} - d^{6}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - c - d\right )}^{3}}}{3 \, f} \]

input
integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e))^4,x, algorithm="gia 
c")
 
output
-1/3*(3*(2*a*c^3 - 4*b*c^2*d + 3*a*c*d^2 - b*d^3)*(pi*floor(1/2*(f*x + e)/ 
pi + 1/2)*sgn(2*c - 2*d) + arctan((c*tan(1/2*f*x + 1/2*e) - d*tan(1/2*f*x 
+ 1/2*e))/sqrt(-c^2 + d^2)))/((c^6 - 3*c^4*d^2 + 3*c^2*d^4 - d^6)*sqrt(-c^ 
2 + d^2)) + (6*b*c^5*tan(1/2*f*x + 1/2*e)^5 - 18*a*c^4*d*tan(1/2*f*x + 1/2 
*e)^5 - 6*b*c^4*d*tan(1/2*f*x + 1/2*e)^5 + 27*a*c^3*d^2*tan(1/2*f*x + 1/2* 
e)^5 + 12*b*c^3*d^2*tan(1/2*f*x + 1/2*e)^5 - 6*a*c^2*d^3*tan(1/2*f*x + 1/2 
*e)^5 - 27*b*c^2*d^3*tan(1/2*f*x + 1/2*e)^5 + 3*a*c*d^4*tan(1/2*f*x + 1/2* 
e)^5 + 12*b*c*d^4*tan(1/2*f*x + 1/2*e)^5 - 6*a*d^5*tan(1/2*f*x + 1/2*e)^5 
+ 3*b*d^5*tan(1/2*f*x + 1/2*e)^5 - 12*b*c^5*tan(1/2*f*x + 1/2*e)^3 + 36*a* 
c^4*d*tan(1/2*f*x + 1/2*e)^3 - 16*b*c^3*d^2*tan(1/2*f*x + 1/2*e)^3 - 32*a* 
c^2*d^3*tan(1/2*f*x + 1/2*e)^3 + 28*b*c*d^4*tan(1/2*f*x + 1/2*e)^3 - 4*a*d 
^5*tan(1/2*f*x + 1/2*e)^3 + 6*b*c^5*tan(1/2*f*x + 1/2*e) - 18*a*c^4*d*tan( 
1/2*f*x + 1/2*e) + 6*b*c^4*d*tan(1/2*f*x + 1/2*e) - 27*a*c^3*d^2*tan(1/2*f 
*x + 1/2*e) + 12*b*c^3*d^2*tan(1/2*f*x + 1/2*e) - 6*a*c^2*d^3*tan(1/2*f*x 
+ 1/2*e) + 27*b*c^2*d^3*tan(1/2*f*x + 1/2*e) - 3*a*c*d^4*tan(1/2*f*x + 1/2 
*e) + 12*b*c*d^4*tan(1/2*f*x + 1/2*e) - 6*a*d^5*tan(1/2*f*x + 1/2*e) - 3*b 
*d^5*tan(1/2*f*x + 1/2*e))/((c^6 - 3*c^4*d^2 + 3*c^2*d^4 - d^6)*(c*tan(1/2 
*f*x + 1/2*e)^2 - d*tan(1/2*f*x + 1/2*e)^2 - c - d)^3))/f
 
3.3.51.9 Mupad [B] (verification not implemented)

Time = 18.53 (sec) , antiderivative size = 439, normalized size of antiderivative = 1.85 \[ \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{(c+d \sec (e+f x))^4} \, dx=\frac {\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^5\,\left (2\,b\,c^3-2\,a\,d^3+b\,d^3-3\,a\,c\,d^2-6\,a\,c^2\,d+6\,b\,c\,d^2+2\,b\,c^2\,d\right )}{{\left (c+d\right )}^3\,\left (c-d\right )}+\frac {4\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3\,\left (-3\,b\,c^3+9\,a\,c^2\,d-7\,b\,c\,d^2+a\,d^3\right )}{3\,{\left (c+d\right )}^2\,\left (c^2-2\,c\,d+d^2\right )}-\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (2\,a\,d^3-2\,b\,c^3+b\,d^3-3\,a\,c\,d^2+6\,a\,c^2\,d-6\,b\,c\,d^2+2\,b\,c^2\,d\right )}{\left (c+d\right )\,\left (c^3-3\,c^2\,d+3\,c\,d^2-d^3\right )}}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (-3\,c^3-3\,c^2\,d+3\,c\,d^2+3\,d^3\right )-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (-3\,c^3+3\,c^2\,d+3\,c\,d^2-3\,d^3\right )+3\,c\,d^2+3\,c^2\,d+c^3+d^3-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\,\left (c^3-3\,c^2\,d+3\,c\,d^2-d^3\right )\right )}+\frac {\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (2\,c-2\,d\right )\,\left (c^3-3\,c^2\,d+3\,c\,d^2-d^3\right )}{2\,\sqrt {c+d}\,{\left (c-d\right )}^{7/2}}\right )\,\left (2\,a\,c^3-4\,b\,c^2\,d+3\,a\,c\,d^2-b\,d^3\right )}{f\,{\left (c+d\right )}^{7/2}\,{\left (c-d\right )}^{7/2}} \]

input
int((a + b/cos(e + f*x))/(cos(e + f*x)*(c + d/cos(e + f*x))^4),x)
 
output
((tan(e/2 + (f*x)/2)^5*(2*b*c^3 - 2*a*d^3 + b*d^3 - 3*a*c*d^2 - 6*a*c^2*d 
+ 6*b*c*d^2 + 2*b*c^2*d))/((c + d)^3*(c - d)) + (4*tan(e/2 + (f*x)/2)^3*(a 
*d^3 - 3*b*c^3 + 9*a*c^2*d - 7*b*c*d^2))/(3*(c + d)^2*(c^2 - 2*c*d + d^2)) 
 - (tan(e/2 + (f*x)/2)*(2*a*d^3 - 2*b*c^3 + b*d^3 - 3*a*c*d^2 + 6*a*c^2*d 
- 6*b*c*d^2 + 2*b*c^2*d))/((c + d)*(3*c*d^2 - 3*c^2*d + c^3 - d^3)))/(f*(t 
an(e/2 + (f*x)/2)^2*(3*c*d^2 - 3*c^2*d - 3*c^3 + 3*d^3) - tan(e/2 + (f*x)/ 
2)^4*(3*c*d^2 + 3*c^2*d - 3*c^3 - 3*d^3) + 3*c*d^2 + 3*c^2*d + c^3 + d^3 - 
 tan(e/2 + (f*x)/2)^6*(3*c*d^2 - 3*c^2*d + c^3 - d^3))) + (atanh((tan(e/2 
+ (f*x)/2)*(2*c - 2*d)*(3*c*d^2 - 3*c^2*d + c^3 - d^3))/(2*(c + d)^(1/2)*( 
c - d)^(7/2)))*(2*a*c^3 - b*d^3 + 3*a*c*d^2 - 4*b*c^2*d))/(f*(c + d)^(7/2) 
*(c - d)^(7/2))